package com.zqh.myfmmall.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDate;
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * <p>
 * 用户 
 * </p>
 *
 * @author chrimer
 * @since 2022-01-20
 */
@Data
@ApiModel(value="Users对象", description="用户 ")
public class Users {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键id 用户id")
    @TableId(type = IdType.ASSIGN_UUID)
    private String userId;

    @ApiModelProperty(value = "用户名")
    private String username;

    @ApiModelProperty(value = "密码 ")
    private String password;

    @ApiModelProperty(value = "昵称 ")
    private String nickname;

    @ApiModelProperty(value = "真实姓名 ")
    private String realname;

    @ApiModelProperty(value = "头像 ")
    @TableField(fill = FieldFill.INSERT)
    private String userImg;

    @ApiModelProperty(value = "手机号 ")
    private String userMobile;

    @ApiModelProperty(value = "邮箱地址 ")
    private String userEmail;

    @ApiModelProperty(value = "性别 M(男) or F(女)")
    private String userSex;

    @ApiModelProperty(value = "生日 ")
    @JSONField(format = "yyyy-MM-dd")
    private LocalDate userBirth;

    @ApiModelProperty(value = "注册时间 ")
    @TableField(fill = FieldFill.INSERT)
//    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
//    @JsonSerialize(using = LocalDateTimeSerializer.class)
//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime userRegtime;

    @ApiModelProperty(value = "更新时间 ")
    @TableField(fill = FieldFill.INSERT_UPDATE)
//    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
//    @JsonSerialize(using = LocalDateTimeSerializer.class)
//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime userModtime;

}
